#ifndef _ARMORDETECTOR_
#define _ARMORDETECTOR_
#include "Armor.h"

class ArmorDetector
{
public:
    Mat draw_img;
    int hmax = 130, hmin = 80;
    int vmax = 255, vmin = 80;
    int smax = 255, smin = 42;
    int TRACK_FRAMES;
    vector<vector<Armor_ptr>> save_armors;
    vector<Blob_ptr> single_blob;
    Mat backgound;
    int save_num = 1;
    int id = 0;
    Mat cameraMatrix;
    Mat distCoeff;
    bool qtMode = false;
    vector<double> angle;
    void detectArmor(Mat &src_img);
    ArmorDetector(const string &filename);
    vector<Armor_ptr> current_armors;
    void filter_repeated(vector<Armor_ptr> &current_armors);
    void img_proc(Mat &src_img, vector<vector<Point>> &contours);
    void find_lightblob(vector<vector<Point>> &contours, vector<Blob_ptr> &single_blob);
    void match_lightblob(vector<Blob_ptr> &single_blob, vector<light_blobs> &matched_blobs);
    void find_corners(Blob_ptr &single_blob);
    static void draw_blob(vector<Point2f> &blob_corners1, vector<Point2f> &blob_corners2, Mat &src_img);
    static double distance(vector<Point2f> &blob);
    static double distance(Point2f a, Point2f b);
};
#endif